﻿using Esint.Common.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Esint.JudicialAuction.Model.Schedule
{
    /// <summary>
    /// 一天的排班
    /// </summary>
    public class OneDayWork :RootModel
    {
        public OneDayWork(DateTime WorkDate)
        {
            Date = WorkDate;
        }
        
        /// <summary>
        /// 中心白班
        /// </summary>
        public OnceWork CenterDaylightWork { get; set; }

        /// <summary>
        /// 中心夜班
        /// </summary>
        public OnceWork CenterNightWork { get; set; }

        /// <summary>
        /// 网信办夜班
        /// </summary>
        public OnceWork OfficeNightWork { get; set; }

        /// <summary>
        /// 网信办白班
        /// </summary>
        public OnceWork OfficeDaylightWork { get; set; }

        private DateTime date;
        /// <summary>
        /// 日期
        /// </summary>
        public DateTime Date {
            get { return date; }
            set
            {
                date = value;
                WorkDateStr = date.ToString("yyyy-MM-dd");
                switch (date.DayOfWeek)
                {
                    default:
                        break;
                    case DayOfWeek.Monday:
                    case DayOfWeek.Tuesday:
                    case DayOfWeek.Wednesday:
                    case DayOfWeek.Thursday:
                    case DayOfWeek.Friday:
                        {
                            CenterDaylightWork = new OnceWork(WorkType.Daylight, WorkPlace.Center,Date);
                            CenterNightWork = new OnceWork(WorkType.Night, WorkPlace.Center, Date);
                            OfficeDaylightWork = null;
                            OfficeNightWork = new OnceWork(WorkType.Night, WorkPlace.Office, Date);
                            break;
                        }
                    case DayOfWeek.Saturday:
                    case DayOfWeek.Sunday:
                        {
                            CenterDaylightWork = new OnceWork(WorkType.Daylight, WorkPlace.Center, Date);
                            CenterNightWork = new OnceWork(WorkType.Night, WorkPlace.Center, Date);
                            OfficeDaylightWork = new OnceWork(WorkType.Daylight, WorkPlace.Office, Date);
                            OfficeNightWork = new OnceWork(WorkType.Night, WorkPlace.Office, Date);
                            break;
                        }
                }

                switch (value.DayOfWeek)
                {
                    default:
                        break;
                    case DayOfWeek.Monday:
                        dayOfWeekStr = "星期一";
                        break;
                    case DayOfWeek.Tuesday:
                        dayOfWeekStr = "星期二";
                        break;
                    case DayOfWeek.Wednesday:
                        dayOfWeekStr = "星期三";
                        break;
                    case DayOfWeek.Thursday:
                        dayOfWeekStr = "星期四";
                        break;
                    case DayOfWeek.Friday:
                        dayOfWeekStr = "星期五";
                        break;
                    case DayOfWeek.Saturday:
                        dayOfWeekStr = "星期六";
                        break;
                    case DayOfWeek.Sunday:
                        dayOfWeekStr = "星期日";
                        break;
                }
            }
        }

        public string WorkDateStr { get; set; }

        private string dayOfWeekStr;

        /// <summary>
        /// 星期几
        /// </summary>
        public string DayOfWeekStr
        {
            get { return dayOfWeekStr; }

            set
            {
                dayOfWeekStr = value;
            }
        }

    }
}
